<?php
header('content-type:text/html; charset=utf-8');
?>
<!DOCTYPE html>
<html>
<head>
<title>订餐系统编写</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" charset="UTF-8" >
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="css/bootstrap.min.css" rel="stylesheet">
<script src="js/jquery-1.11.1.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<!--[if lt IE 9]>
<script src="js/html5shiv.js"></script>
<script src="js/respond.min.js"></script>
<![endif]-->
</head>
<body>

<nav class="navbar navbar-default">
<div class="container">
  <div class="container-fluid">
    <!-- Brand and toggle get grouped for better mobile display -->
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        </button>
        <a class="navbar-brand" href="text.php">点餐系统</a>
        <ul class="nav navbar-nav">
        <li class="dropdown">
        <a href="#" class="dropdown-toggle" data-toggle="dropdown" >订单管理 <span class="caret"></span></a>
        <ul class="dropdown-menu">
        		<li><a href="orderList.php">订单列表</a></li>
        		<li><a href="orderHistoryList.php">订单记录</a></li>
          </ul>
          </li>
          </ul>  
           
          <ul class="nav navbar-nav">
          <li class="dropdown">
          <a href="#" class="dropdown-toggle" data-toggle="dropdown" >菜品管理 <span class="caret"></span></a>
          <ul class="dropdown-menu">
          <li><a href="cinpinadd.php">添加菜品</a></li>
          <li><a href="dishList.php">菜品列表</a></li>
           <li class="divider"></li>
          <li><a href="dishTypeAdd.php">添加菜品类型</a></li>
          <li><a href="dishTypeList.php">菜品类型列表</a></li>
          </ul>
          </li>
          </ul>

          <ul class="nav navbar-nav">
          <li class="dropdown">
          <a href="#" class="dropdown-toggle" data-toggle="dropdown" >餐桌管理 <span class="caret"></span></a>
          <ul class="dropdown-menu">
          <li><a href="canzhuo.php">添加餐桌</a></li>
          <li><a href="CZlist.php">餐桌列表</a></li>
          </ul>
          </li>
          </ul>

          <ul class="nav navbar-nav">
          <li class="dropdown">
          <a href="#" class="dropdown-toggle" data-toggle="dropdown" >登录管理 <span class="caret"></span></a>
          <ul class="dropdown-menu">
          <li><a href="#" data-toggle="modal" data-target="#1">关于点餐系统</a></li>
          <li class="divider"></li>
          <li><a href="#">修改登录信息</a></li>
          <li><a href="#" data-toggle="modal" data-target="#2">退出登录</a></li>
          </ul>
          
           
          	<div id="1" class="modal">
							<div class="modal-dialog">
								<div class="modal-content">
									<div class="modal-header">
										<span class="close" data-dismiss="modal">&times;</span>
										<div class="modal-title">
											<h4>关于点餐系统编写</h4>
										</div>
									</div>
									<div class="modal-body">
										<h4>本点餐系统是喻德软件快训的一个程序入门Demo！
											仅PHP+html+css实现，不包含一句javascript代码的哦。</h4>
									</div>
									<div class="modal-footer">
										<button class="btn btn-success" data-dismiss="modal">确定</button>
									</div>
								</div>
							</div>						
						</div>
						
						<div id="2" class="modal">
							<div class="modal-dialog">
								<div class="modal-content">
									<div class="modal-header">
										<span class="close" data-dismiss="modal">&times;</span>
										<div class="modal-title">
											<h4>提示!</h4>
										</div>
									</div>
									<div class="modal-body">
										<h4>你确定退出？</h4>
									</div>
									
								<div class="modal-footer">
								<a  type="submit" class="btn btn-success" href="abort.php">确定</a>
								<button  type="button" class="btn btn-success" data-dismiss="modal">取消</button>
								</div>
								
								</div>
							</div>						
						</div>
          </li>
          </ul>

          </div>
          </div>
          </div>
          </nav>
          
	<div class="container">
		<div class="row">
			<div class="col-sm-3 col-md-2 page-left">
	        <a class="btn btn-default btn-block" href="caipinadd.php">添加菜品</a>
	        <a class="btn btn-default btn-block" href="dishList.php">菜品列表</a>
	         <a class="btn btn-default btn-block" href="text.php">返回首页</a>
	        </div>
	        
		<div class="col-sm-6 col-md-5 col-lg-4">
        <div class="panel panel-success">
            <div class="panel-heading">
            

					<?php
					 $pdo=new PDO('mysql:dbname=mk;charset=utf8;','root');
					 @$id=$_REQUEST['id'];
					 $sql=$pdo->prepare('select * from picture where id=:id');
					 $sql->execute(array('id'=>$id));
					 $picture=$sql->fetch();
					?>
                <h1 class="panel-title">
                    <span class="glyphicon glyphicon-edit"></span>
                                                            编辑菜品-<?php echo $picture['name']?></h1>
            </div>
                    <div class="panel-body">
                    <form action="dishUpdate.php" method="post" class="form-horizontal" enctype="multipart/form-data">
                   
                   
                    <div class="form-group">
                        <label class="control-label col-sm-3 hidden-xs">菜名：</label>
                        <div class="col-sm-9">
                        <input type="hidden" name="id" value="<?php echo $picture['id'];?>">
                            <input required="required" name="name" value="<?php echo $picture['name']?>" class="form-control" placeholder="菜名">
                        </div>
                    </div>
                    
                    <div class="form-group">
                        <label class="control-label col-sm-3 hidden-xs">单价：</label>
                        <div class="col-sm-9">
                            <input required="required" name="prize" value="<?php echo $picture['prize']?>" type="number" min="1" class="form-control" placeholder="单价">
                        </div>
                    </div>
                    
                    
                    <div class="form-group">
                        <label class="control-label col-sm-3 hidden-xs">类型：</label>
                        <div class="col-sm-9">
        				   <select  class="form-control" name="typeId">
        				  <option value="">select</option>
		        		<?php
							$sql =$pdo->prepare('select * from type');
							$sql->execute();
							$typeList=$sql->fetchAll(PDO::FETCH_NAMED);
							 foreach ($typeList as $typeitem){
							 ?>
                   <option value="<?php echo $typeitem['id']?>" 
                          <?php echo ($picture['typeId']==$typeitem['id']?' selected="true"':'');?>>
                              <?php echo $typeitem['name']?></option>
							     <?php  }?>
        		 </select>
                   </div>
                    </div>
                    
                    <div class="form-group">
                        <label class="control-label col-sm-3 hidden-xs">图片：</label>
                        <div class="col-sm-9">
                            <input type="file" name="img" class="form-control">
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-sm-offset-3 col-sm-4">
                            <button  type="submit" class="btn btn-success btn-block">修改</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
	</div>
	        
		</div>
	</div>
</body>
</html>